/**
 * 行政管理接口
 */
import request from '@/utils/request';

/**
 * 工位地点-分页列表
 * @param {*} params
 */
export async function getSiteList(params) {
    return request('/api/work/v1/office/cubicle/address/page', {
        method: 'POST',
        data: params
    });
}


/**
 * 工位信息-分页列表
 * @param {*} params
 */
export async function getStationList(params) {
    return request('/api/work/v1/office/cubicle/page', {
        method: 'POST',
        data: params
    });
}

/**
 * 工位信息-新增工位信息
 * @param {*} params
 */
export async function handleAddStation(params) {
    return request('/api/work/v1/office/cubicle/add', {
        method: 'POST',
        data: params
    });
}

/**
 * 工位管理-工位地点下拉列表
 */
export async function getSiteSelectList() {
    return request('/api/work/v1/office/cubicle/address/list', {
        method: 'GET'
    });
}

/**
 * 工位信息-关联员工
 * @param {*} params
 */
export async function handleRelativeEmployee(params) {
    return request('/api/work/v1/office/cubicle/link_employee', {
        method: 'PUT',
        data: params
    });
}

/**
 * 关联状态查询-通过员工code查询是否分配工位
 * @param employeeCode
 */
export async function getEmployeeStationStatus(employeeCode) {
    return request(`/api/work/v1/office/cubicle/employee/status/${employeeCode}`, {
        method: 'GET'
    });
}

/**
 * 工位信息-解除关联
 * @param {*} params
 */
export async function handleUnRelativeEmployee(params) {
    return request('/api/work/v1/office/cubicle/unlink_employee', {
        method: 'PUT',
        data: params
    });
}

/**
 * 工位信息-解除关联，并重新关联
 * @param {*} params
 */
export async function handleUnRelativeEmployeeRelink(params) {
    return request('/api/work/v1/office/cubicle/unlink_and_relink', {
        method: 'PUT',
        data: params
    });
}

/**
 * 工位信息-批量解除关联
 * @param {*} params
 */
export async function handleBatchUnRelativeEmployee(params) {
    return request('/api/work/v1/office/cubicle/batch_unlink_employee', {
        method: 'PUT',
        data: params
    });
}

/**
 * 删除工位信息
 */
export async function handleDeleteStation(id) {
    return request(`/api/work/v1/office/cubicle/${id}`, {
        method: 'DELETE'
    });
}

/**
 * 删除工位信息，并重新关联
 * @param {*} params
 */
export async function handleDeleteStationRelink(params) {
    return request('/api/work/v1/office/cubicle/delete_and_relink', {
        method: 'PUT',
        data: params
    });
}

/**
 * 区域列表-通过办公地点查询可用区域的列表信息
 */
export async function getValidArea(addressCode) {
    return request(`/api/work/v1/office/cubicle/list/addressCode/${addressCode}`, {
        method: 'GET'
    });
}

/**
 * 可用编号查询-查询某个区域内已规划编号
 */
export async function getUsedStation({ addressCode, cubicleArea }) {
    return request(`/api/work/v1/office/cubicle/addressCode/${addressCode}/cubicleArea/${cubicleArea}`, {
        method: 'GET'
    });
}

/**
 * 可用编号查询-查询某个区域内已规划编号
 */
export async function getAreaSelect() {
    return request('/api/work/v1/office/cubicle/select_area', {
        method: 'GET'
    });
}

/**
 * 同步办公地点数据
 */
export async function getSyncSite() {
    return request('/api/work/v1/office/cubicle/address/actions_sync', {
        method: 'GET'
    });
}

/**
 * 获取全部办公地点下拉选择
 */
export async function getAllSiteAddress(params) {
    return request('/api/org/v1/address/queryListInfoByAuditStatus', {
        method: 'POST',
        data: params
    });
}
